﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using ThirdServices.AlertModel.Factory.Entities.DTO;
using ThirdServices.AlertModel.FogSettings;

namespace ThirdServices.AlertModel.Analyzers
{
    class FogAnalyser
    {
        public static List<BaseAlert> AnalyseFogData(List<FogData> tempData, double delta, int periodInDays)
        {
            List<BaseAlert> baseAlerts = new List<BaseAlert>();
            for (int i = 0; i < tempData.Count; i++)
            {
                if (tempData[i].Fog >= delta)
                {
                    baseAlerts.Add(new BaseAlert
                    {
                        NotificationDescription = new NotificationDescription
                        {
                            alert_type =
                                AlertTypes.FogAlert,
                            notification =
                                Convert.ToString(tempData[i].Date,
                                                 CultureInfo.
                                                     InvariantCulture) +
                                " , " +
                                Convert.ToString(delta,
                                                 CultureInfo.
                                                     InvariantCulture) + "%"
                        }
                    });
                }
            }
            return baseAlerts;
        }
    }
}
